<template>
	<view style="padding-bottom: 102rpx; margin-top: 20rpx;">
		<view class="shangdian shadow" v-for="(item, index) in data" :key="index" @click="jump(item.id)">
			<p class="text-shadow">{{ item.title }}</p>
			<view class="shangdian_a">
				<view class="tit_a">
					<view class="tit_a_a">{{ item.type }}</view>
					<view class="tit_a_b">会员{{ item.num_day }}</view>
				</view>
				<view class="tit_b">
					<image src="../../../static/wezhi.png" mode=""></image>
					<span>{{ item.site }}</span>
				</view>
			</view>
			<view class="xian_qing">
				<image :src="item.cover" mode="aspectFill"></image>
				<view class="xiangqing">
					<p class="xiangqing_name text-shadow">{{ item.name }}</p>
					<span>￥{{ item.price }}/天</span>
					<span class="yuan_jia">￥{{ item.lineation }}/天</span>
					<p class="be_zhu">{{ item.brief }}</p>
				</view>
			</view>
		</view>
		<view class="add" >
			<view class="adda shadow-lg" @click="add"><u-icon name="plus" color="#FF1A14" size="50" :class="{ donghua: i  }"></u-icon></view>
		</view>
		<u-loadmore :status="loadmore" style="margin: 30rpx 0 !important;" />
	</view>
</template>

<script>
export default {
	data() {
		return {
			// nomore  loading  loadmore
			status: 'loadmore',
			page: 1,
			limit: 100,
			data: [],
			i: false,
		};
	},
	onLoad(e) {
		uni.setNavigationBarColor({
			frontColor: '#ffffff',
			backgroundColor: '#ff0000',
		});
		this.getId();
	},
	onShow() {
		this.getId();
	},
	methods: {
		add(){
			this.i = true
			setTimeout(() => {
				this.i = false
				uni.navigateTo({
					url: './addingGoods',
				});
			}, 300);
			
			
			
		},
		jump(id){
			uni.navigateTo({
				url: 'addingGoods?id='+id,
			});
			
			
		},
		
		/*  获取id */
		async getId() {
			let obj = {
				uid: uni.getStorageSync('uid'),
			};
			const res = await this.$u.post('api/shop/shop_select', obj, {});

			this.productLst(res.data.id);
			uni.setStorageSync('did', res.data.id)
		},
		/* 商品列表 */
		async productLst(did) {
			let obj = {
				did,
				page: this.page,
				limit: this.limit,
				//uid: uni.getStorageSync("uid"),
			};
			const res = await this.$u.post('api/shop/goods_list', obj, {});
			
			this.data = res.data;
			this.total = res.data.total;
		},
	},
	onReachBottom() {},
};
</script>

<style lang="scss" scoped>
.add {
	position: fixed;
	bottom: 60rpx;
	right: 60rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100rpx;
	height: 100rpx;
	border-radius: 50%;
	background-color: #f5f8fd;
	.adda {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 80rpx;
		height: 80rpx;
		background-color: #ffffff;
		border-radius: 50%;
		
	}
}
.shangdian {
	width: 690rpx;
	margin: auto;
	height: 345rpx;
	background-color: #ffffff;
	border-radius: 10rpx;
	margin-bottom: 20rpx;

	p {
		width: 650rpx;
		height: 65rpx;
		line-height: 80rpx;
		font-size: 30rpx;
		color: #333333;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		margin-left: 20rpx;
	}
	.shangdian_a {
		width: 650rpx;
		height: 60rpx;
		margin-left: 20rpx;
		display: flex;
		justify-content: space-between;
		.tit_a {
			width: 250rpx;
			height: 40rpx;
			display: flex;
			justify-content: space-between;
			.tit_a_a {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 105rpx;
				height: 33rpx;
				border: 2rpx solid #ff0000;
				color: #ff0000;
				font-size: 20rpx;
				text-align: center;

				border-radius: 4px;
				margin-top: 10rpx;
			}
			.tit_a_b {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 105rpx;
				height: 33rpx;
				border: 2rpx solid #ff0000;
				color: #ff0000;
				font-size: 20rpx;
				text-align: center;

				border-radius: 4px;
				margin-top: 10rpx;
			}
		}
		.tit_b {
			width: 260rpx;
			height: 50rpx;
			display: flex;
			margin-top: 10rpx;
			image {
				width: 23rpx;
				height: 26rpx;
				margin-right: 10rpx;
			}
			span {
				display: block;
				width: 180rpx;
				height: 30rpx;
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #999999;
				line-height: 30rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}
		}
	}
	.xian_qing {
		width: 650rpx;
		height: 200rpx;
		margin: auto;
		display: flex;
		justify-content: space-between;
		image {
			width: 200rpx;
			height: 200rpx;
		}
		.xiangqing {
			width: 430rpx;
			height: 200rpx;
			// border: 1rpx solid red;
			.xiangqing_name {
				width: 370rpx;
				height: 40rpx;
				line-height: 40rpx;
				text-overflow: ellipsis;
				white-space: nowrap;
				margin-left: 20rpx;
				margin-bottom: 10rpx;
			}
			span {
				color: #ff0000;
				margin-left: 20rpx;
			}
			.yuan_jia {
				color: #999999;
				font-size: 24rpx;
				text-decoration: underline;
				text-decoration: line-through;
				margin-left: 15rpx;
			}
			.be_zhu {
				width: 370rpx;
				height: 80rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				margin-left: 20rpx;
				font-size: 24rpx;
				color: #999999;
				// border: 1rpx solid red;
			}
		}
	}
}
</style>
